<?php

require  './configs/config.php';


//自动加载类

function __autoload($classname)
{
	//echo $classname;
	if(file_exists("./models/{$classname}.class.php")){
		require "./models/{classname}.class.php";
	}elseif(file_exists("./controllers/{$classname}.class.php")){
		require"./controllers/{$classname}.class.php";
	}else{
		header('HTTP/1.0 404 not found');
		header('Status:404 not found');//IE
		echo '<h1>404 NOT FOUND</h1>';
		exit;
	}
}

//获取用户参数   index.php?m=控制器名&a=操作名
//index.php?m=Goods&a=add
//获取控制器名

$m = (!empty($_GET['m']))?$_GET['m']:'Index';

//获取操作名
$a = (!empty($_GET['a']))?$_GET['a']:'index';

//拼接类名
$classname =$m.'Controller';

//实例化控制器
$controller = new $classname();

//var_dump($controller);

$controller->$a();